﻿<!--#include file="utf-8.asp"-->
<!--#include file="conn.asp"-->
<!--#include file="seeion.asp"-->
<!--#include file="page.asp"-->
<% 

if request("act") = "output" then
	Response.Buffer = True 
	Response.ContentType = "application/vnd.ms-excel" 
	Response.AddHeader "content-disposition", "inline; filename = 用户信息"& date &".xls" 
	
	if response.IsClientConnected then'是观察用户是否仍连到服务器
	response.Flush()
	else
	response.End()
	end if

end if







if p_type = "searchresult" then

	tmpsql  = ""
	tmpsql1 = ""
	tmpsql2 = ""
	tmpsql3 = ""
	tmpsql4 = ""
	
	if Trim(request.form("user_name")) <> "" then tmpsql1 = tmpsql1 & " user_name like '%"& Trim(request.form("user_name")) &"%' "
	'if Trim(request.form("user_name")) <> "" then tmpsql1 = tmpsql1 & " user_name='" & Trim(request.form("user_name")) & "'"
	
	if Trim(request.form("CompanyName")) <> "" then tmpsql2 = tmpsql2 & " CompanyName like '%"& Trim(request.form("CompanyName")) &"%' "
	
	
	if Trim(request.form("jifen")) <>""  then
		if Trim(request.form("jifensel")) = 0 then
			tmpsql3 = tmpsql3 & " jifen < "& Trim(request.form("jifen")) 
		else
			tmpsql3 = tmpsql3 & " jifen > "& Trim(request.form("jifen")) 
		end if
	end if
	
	if Trim(request.form("LvJifen")) <>""  then
		if Trim(request.form("lvsel")) = 0 then
			tmpsql4 = tmpsql4 & " LvJifen < "& Trim(request.form("LvJifen")) 
		else
			tmpsql4 = tmpsql4 & " LvJifen > "& Trim(request.form("LvJifen")) 
		end if
	end if
	
	tmpsql = "select * from [User] where "
	
	if tmpsql1<>"" then tmpsql = tmpsql & tmpsql1
'	if tmpsql2<>"" then tmpsql = tmpsql & tmpsql2
'	if tmpsql3<>"" then tmpsql = tmpsql & tmpsql3 
'	if tmpsql4<>"" then tmpsql = tmpsql & tmpsql4 

end if


%> 



<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>列表管理</title>
<link href="images/style.css" type="text/css" rel="stylesheet" />
<style type="text/css">
<!--
-->
</style>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="cedced">
      <tr bgcolor="e9f1fa">
        <td><table width="100%" border="0" cellpadding="0" cellspacing="0" style="font-family : sans-serif;">
          <tr height="25">
            <td width="5%
" align="center">ID</td>
            <td width="15%">用户名</td>
            <td width="15%">公司名称</td>
            <td width="10%">联系电话</td>
            <td width="15%">邮箱地址</td>
            <td width="5%" align="center">积分</td>
            <td width="5%" align="center">评级积分</td>
            <td width="8%" align="center">状态</td>
            <td width="12%" align="center">兑换积分有效期</td>
            <td width="12%" align="center">评级积分有效期</td>
          </tr>
        </table></td>
      </tr>
    </table>
      <%	
    set rs=server.createobject("adodb.recordset") 
	if tmpsql = "" then
		exec="select * from [user] order by datetime desc" 
	else
		exec = tmpsql
	end if
    rs.open exec,conn,1,1 
    if rs.eof then
		response.Write "&nbsp;暂无数据！"
		response.end
    else
		rs.PageSize =10 '每页记录条数
		iCount=rs.RecordCount '记录总数
		iPageSize=rs.PageSize
		maxpage=rs.PageCount 
		page=request("page")
		if Not IsNumeric(page) or page="" then
			page=1
		else
			page=cint(page)
		end if
		if page<1 then
			page=1
		elseif  page>maxpage then
			page=maxpage
		end if
		rs.AbsolutePage=Page
		if page=maxpage then
			x=iCount-(maxpage-1)*iPageSize
		else
			x=iPageSize
		end if	
    %>
      <%For i=1 To x%>
      <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="cedced" style="font-family:sans-serif;margin:5px 0;">
        <tr height="25">
          <td width="5%" align="center" bgcolor="#FFFFFF"><%=rs("id")%></td>
          <td width="15%" bgcolor="#FFFFFF"><%=rs("user_name")%></td>
          <td width="15%" bgcolor="#FFFFFF"><%=rs("CompanyName")%></td>
          <td width="10%" bgcolor="#FFFFFF"><%=rs("Phone")%></td>
          <td width="15%" bgcolor="#FFFFFF"><%=rs("Email")%></td>
          <td width="5%" align="center" bgcolor="#FFFFFF"><%=rs("Jifen")%></td>
          <td width="5%" align="center" bgcolor="#FFFFFF"><%=rs("LvJifen")%></td>
          <td width="8%" bgcolor="#FFFFFF" align="center"><%
			if rs("Status") = true then
			response.write "过期用户"
			else
			response.write "在租用户"
			end if
    %></td>
          <td width="12%" align="center" bgcolor="#FFFFFF"><%=rs("JifenPeriod")%></td>
          <td width="12%" align="center" bgcolor="#FFFFFF"><%=rs("LvJifenPeriod")%></td>
        </tr>
      </table>
      <%rs.movenext
    next
	end if
    %></td>
  </tr>
</table>

<a href="?act=output">数据导出</a>


</body> 
</html>
